﻿using System.Windows;
using System.Windows.Threading;

namespace MeterReader.WPF.Views
{
	/// <summary>
	/// MainWindow.xaml 的交互逻辑
	/// </summary>
	public partial class MainWindow : Window
	{
		private DispatcherTimer _timer;

		public MainWindow()
		{
			InitializeComponent();
			
		}
		private void Window_Loaded(object sender, RoutedEventArgs e)
		{
			dateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
			_timer = new DispatcherTimer() { Interval = TimeSpan.FromSeconds(1) };
			_timer.Tick += CurrentTime;
			_timer.Start();
		}

		private void CurrentTime(object sender, EventArgs e)
		{
			dateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
		}
	}
}